package com.github.springboot.controller;

import com.alibaba.fastjson.JSON;
import com.github.springboot.constant.RedisConstants;
import com.github.springboot.entity.User;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * Created by kjtang on 2018/1/22.
 */
@Api("用户管理API")
public class UserController {


    @Autowired
    private RedisTemplate redisTemplate;

    private String

    @RequestMapping("/testJedisCluster")
    public User saveUser(@RequestBody User user){
            String value =  myRedisTemplate.get(MyConstants.USER_FORWARD_CACHE_PREFIX, username);
            if(StringUtils.isBlank(value)){
                  myRedisTemplate.set(RedisConstants.USER_MODULE_PREFIX, username, JSON.toJSONString(user));
            }
          return JSON.parseObject(value, User.class);
    }

}
